print all distinct elements of a given integer array